package com.weixing.mall.provider.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.weixing.mall.provider.model.domain.OrderAgent;
import com.weixing.mall.provider.model.vo.OrderAgentVo;
import com.weixing.mall.provider.model.vo.agent.UpPayReceiveVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * <p>
 * 订单和 Mapper 接口
 * </p>
 *
 * @author Small
 * @since 2020-05-27
 */
public interface OrderAgentMapper extends BaseMapper<OrderAgent> {

    UpPayReceiveVo countReceiveAndUpPay(@Param("agentId") Long agentId,
                                        @Param("startTime") String startTime,
                                        @Param("endTime") String endTime,
                                        @Param("selectedAgentId")Long selectedAgentId);

    void updateEnable(Long orderId);

    IPage<OrderAgentVo> selectListOfPage(@Param("pg") IPage page, @Param("agentId") Long agentId);

    BigDecimal todayProfit(@Param("agentId") Long agentId, @Param("datefmt") String datefmt);

    BigDecimal totalProfit(@Param("agentId") Long agentId,  @Param("startTime") String startTime,  @Param("endTime") String endTime);

    OrderAgent findByOrderIdAndAgentId(@Param("orderId") Long orderId, @Param("agentId") Long agentId);

    BigDecimal sumNeedUppayBySettleState(@Param("agentId") Long agentId,
                                         @Param("settleState") int settleState,
                                         @Param("startTime") String startTime,
                                         @Param("endTime") String endTime,
                                         @Param("selectedAgentId")Long selectedAgentId);

    OrderAgent findKefuReceive(@Param("orderId")Long orderId, @Param("kefuId")Long kefuId);

    BigDecimal sumKefuUpPayStatistics(@Param("agentId") Long agentId,
                                      @Param("settleState") int settleState,
                                      @Param("startTime") String startTime,
                                      @Param("endTime") String endTime,
                                      @Param("selectedAgentId")Long selectedAgentId);
}
